package bio;

import java.io.IOException;
import java.net.Socket;
import java.time.LocalDateTime;

/**
 * @ClassName IoClient
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/8/20 15:27
 * @Version 1.0
 */
public class IOClient {
    public static void main(String[] args) {
        new Thread(() -> {
            final Socket socket;
            try {
                socket = new Socket("127.0.0.1", 3333);
                while (true) {
                    socket.getOutputStream().write((LocalDateTime.now() + ": Hello world").getBytes());
                    Thread.sleep(2000);
                }
            } catch (IOException | InterruptedException e) {
                e.printStackTrace();
            }

        }).start();
    }
}
